<template>
      <div>
        <img src="../../../assets/img/img/维系登录(1).png" alt="">
      <ul>
        <li>手机号<input type="text" v-model="user.phone"></li>
        <li>密 &nbsp; 码<input type="text" v-model="user.password"></li>
      </ul>
        
      <input type="button" value="登录" @click="login">
      </div>
</template>

<script>
import {reqLogin} from "../../../http/api.js" 
export default {
  data(){
    return {
      user:{
        phone:"",
        password:"",
      }
    }
  },
  methods:{
    login(){
      reqLogin(this.user).then(res => {
        if(res.data.code==200){
          localStorage.setItem("ispass",true)
          localStorage.setItem("user",JSON.stringify(res.data.list))
          this.$router.push("/index/store")
        }
      })
    }
  },
  // mounted(){
  //   axios({
  //       url:'/api/userlogin',
  //       method:"POST",
  //       data:{
  //         username:this.username,
  //         password:this.password
  //       }
  //   })
  // }
}
</script>

<style scoped>
div {
  margin: 0.2rem auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 14rem;
  background: white;
}
img {
  width: 3.63rem;
  height: 0.96rem;
  margin: 0 auto;
}
ul {
  width: 6.1rem;
  margin-top: 0.8rem;
}
ul li {
  height: 0.8rem;
  border-bottom: 1px solid #d6d6d6;
  font-size: 0.22rem;
  line-height: 0.8rem;
  color: gray;
}
li input{padding-left: 20px;}
div > input {
  width: 6.1rem;
  height: 0.96rem;
  color: white;
  background: #CCCCCC;
  margin-top: 0.4rem;
}
</style>